<template>
  <div class="navbar">
    <van-nav-bar
      :title="title"
      left-text="返回"
      right-text
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
  </div>
</template>

<script>
import { Toast } from "vant";
export default {
  name: "Navbar",
  created() {},
  methods: {
    onClickLeft() {
      // 编程式的导航 后退
      this.$router.back();
    },
    onClickRight() {
      Toast("按钮");
    }
  },
  computed: {
    title() {
      return this.$route.meta.title || "购物车";
    }
  }
};
</script>

<style lang="less" scoped>
</style>
